package com.wust.service.impl;

import com.wust.dao.DataMapper;
import com.wust.db.DataSource;
import com.wust.entity.Data;
import com.wust.service.IDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by lenovo on 2018/5/30.
 */
@Service("iDataService")//切换至IoT数据库中获取数据
public class DataServiceImpl implements IDataService {

    @Autowired
    private DataMapper dataMapper;

    //统计设备号获得数据
    public Data selectLatestDeviceData(int deviceId){
        Data data = dataMapper.selectByDeviceId(deviceId);
        return data;
    }

    //获取心率，血压
    public Data selectLatestDeviceFirstData(int deviceId){
        Data data = dataMapper.selectByDeviceId(deviceId);
        return data;
    }

    //获取体温，室温
    public Data selectLatestDeiviceSecondData(int deviceId){
        Data data = dataMapper.selectByDeviceId(deviceId);
        return data;
    }

    //获取心率，血压
    public List<Data> selectLatestDeviceFirstDatas(int deviceId){
        List<Data> datas = dataMapper.selectByDeviceIds(deviceId);
        return datas;
    }

    //获取体温，室温
    public List<Data> selectLatestDeiviceSecondDatas(int deviceId){
        List<Data> datas = dataMapper.selectByDeviceIds(deviceId);
        return datas;
    }

}
